const app = getApp<IAppOption>()

Page({
  data: {
    current: 0,
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 800,
    circular: true,
    News:[],
    newsIndex:0,
    ImgUrls:[]
    
  },
  getNews(){
    let timer = setTimeout(()=>{
      let news = [
        {
          id:1,
          title:'简雅新中式，极致的东方惊艳！'
        },
        {
          id:1,
          title:'新商品！'
        },
        {
          id:1,
          title:'打折降价了！'
        }

      ]
      this.setData({
        news
      })
    },2000)
  },
changeNewsIndex(){
  setInterval(()=>{
    let newsIndex = this.data.newsIndex
    newsIndex ++
    console.log('this.data.News');
    if(newsIndex == this.data.news.length) newsIndex =0
    this.setData({
      newsIndex
    })
  },2000)
},
getImgUrls(){
  wx.request({
    url: 'https://obuge.com/juzao/index/ImgUrls',
  
    success (res) {
      console.log(res.data)
    }
  })
let timer =setTimeout(()=>{
  let imgUrls = [
    {
      id:1,
      img:'/image/diyi.png',
      path:'pages/index/index'
    },
    {
      id:1,
      img:'/image/diyi.png',
      path:'pages/index/index'
    },
    {
      id:1,
      img:'/image/diyi.png',
      path:'pages/index/index'
    }

  ]
  this.setData({
    imgUrls
  })
},3000)
},
onLoad(_query){
  this.getNews()
  this.changeNewsIndex()
  this.getImgUrls()
}

})
